package com.learn.repository;

import com.learn.entity.AdminEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface AdminRepository extends JpaRepository<AdminEntity,Integer>{

    @Query("select a from AdminEntity a where a.id = :id")
    public AdminEntity findById(@Param("id") int id);

    @Query("delete from AdminEntity where id = :id")
    public boolean delete(@Param("id") int id);

    @Query("select a from AdminEntity a where a.name = :name")
    public AdminEntity findByName(@Param("name") String name);
}
